#!/usr/bin/python
import os
import sys

bench_name = sys.argv[1]

def gen_cmd(bench):
    ret = ('python LLVMcmd.py opt %s/%s.linked.rbc %s/%s.abc.linked.rbc -abc;'
           'python LLVMcmd.py opt %s/%s.abc.linked.rbc %s/%s.gvn.linked.rbc -mem2reg -gvn;'
           'python LLVMcmd.py opt %s/%s.gvn.linked.rbc %s/%s.pinode.linked.rbc -pinode;'
           'python LLVMcmd.py opt %s/%s.pinode.linked.rbc %s/%s.abcd.linked.rbc -abcd;'
           'python LLVMcmd.py opt %s/%s.llvm.bc %s/%s.abc.llvm.bc -abc;'
           'python LLVMcmd.py opt %s/%s.abc.llvm.bc %s/%s.gvn.llvm.bc -mem2reg -gvn;'
           'python LLVMcmd.py opt %s/%s.gvn.llvm.bc %s/%s.pinode.llvm.bc -pinode;'
           'python LLVMcmd.py opt %s/%s.pinode.llvm.bc %s/%s.abcd.llvm.bc -abcd;'
           %(bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench,
             bench, bench, bench, bench)
          )
    return ret


sys.stdout.flush()
os.system(gen_cmd(bench_name))
